// Introduction
fn main() {
	// x is on the stack
	// however Vector allocates memory on heap
	// x own the Vector
	// when x goes out of scope
	// the vector’s memory will be de-allocated
	let mut x = vec!["Hello", "World"];

	// y reference to first element of Vector
	// reference similar to pointer with compile-time safty checks 
	// reference borrowing what they point to
	// rather than owning it
	// let y = &x[0];

	// x.push("foo");
	// compile error
	// x is mutable, but it has been immutable borrowed by y
	// if the memory of Vector have been reallocate
	// y will reference to nothing, namely a dangling pointer

	// there are two solutions
	// the first is making a copy rather than a reference
	// let y = x[0].clone();
	// x.push("foo");
	// this time y is no longer a reference, but a copy of x[0]
	// if we truly want a reference, there is other option:
	// ensure that reference go out of scope before try to do mutation
	// that's it we deftion y in a inner scope
	// {
	// 		let y = &x[0];
	// }


}